﻿ <lib:NotificationWindow x:Class="PasswordProvider.View.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:lib="clr-namespace:PasswordProvider.View.Library"    
    xmlns:behavior="clr-namespace:PasswordProvider.View.Behaviors"
    Height="450" Width="320" 
    Icon="/PasswordProvider.View;component/Properties/Resources/LockAndKey.ico"
    ResizeMode="CanResize"                         
    Title="{Binding DisplayName}"                         
    RunInSystemTray="{Binding RunInSystemTray, Mode=OneWay}"
    PinWindowOpen="{Binding PinWindowOpen, Mode=OneWay}"
    AlwaysOnTop="{Binding AlwaysOnTop, Mode=OneWay}"                         
    MinimizeToSystemTray="{Binding MinimizeToSystemTray, Mode=OneWay}"
    WindowPosition="{Binding WindowPosition}"
    FocusManager.FocusedElement="{Binding ElementName=_frameMain}"
    
    >
     
    <Window.InputBindings>
        <!-- Binding commands to KeyBinding, possible because of class CommandBindingExtension -->
        <KeyBinding Key="F1" Command="{behavior:CommandBinding ShowHelpCommand.Command}" />
    </Window.InputBindings>
    
     <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Height="22" Width="Auto"
              HorizontalAlignment="Stretch" VerticalAlignment="Top"
              Background="{StaticResource MenuBackground}"
              Visibility="{Binding MenuVisibility}"
              >
            <Menu Background="{DynamicResource MenuBackground}" Foreground="{DynamicResource MenuForeground}">
                <MenuItem  IsTabStop="False"
                           Header="{Binding ShowOptionsCommand.DisplayName}" 
                          ToolTip="{Binding ShowOptionsCommand.ToolTip}" 
                          Command="{Binding ShowOptionsCommand.Command}" />
                <MenuItem  IsTabStop="False"
                           Header="{Binding ShowManageCommand.DisplayName}"
                           ToolTip="{Binding ShowManageCommand.ToolTip}"
                           Command="{Binding ShowManageCommand.Command}" />
                <MenuItem  IsTabStop="False"
                           Header="{Binding LogOffCommand.DisplayName}" 
                          ToolTip="{Binding LogOffCommand.ToolTip}" 
                          Command="{Binding LogOffCommand.Command}" />
            </Menu>
            <!--Two menus, only way to get the ? to be right justified when all other items are left justified.-->
            <Menu HorizontalAlignment="Right" Background="Transparent" Foreground="{DynamicResource MenuForeground}" IsTabStop="False">
                <MenuItem  IsTabStop="False" HorizontalAlignment="Right" Margin="0,0,5,0"
                          Header="{Binding ShowHelpCommand.DisplayName}" 
                          ToolTip="{Binding ShowHelpCommand.ToolTip}" 
                          Command="{Binding ShowHelpCommand.Command}"
                          CommandParameter="Beginning"/>                
            </Menu> 
        </Grid>
         <Frame Grid.Row="1" Name="_frameMain" IsTabStop="False" NavigationUIVisibility="Hidden"/>
        
	</Grid>
</lib:NotificationWindow>


